﻿using System.Configuration;
using System.Data.SqlClient;

namespace PUBCOM
{
    public class PubConstant
    {
        /// <summary>
        /// 得到web.config里配置项的数据库连接字符串。
        /// </summary>
        /// <param name="configName"></param>
        /// <returns></returns>
        public static string GetConnectionString(string configName)
        {
            string connectionString = ConfigurationManager.AppSettings[configName];
            //string ConStringEncrypt = ConfigurationManager.AppSettings["ConStringEncrypt"];
            //if (ConStringEncrypt == "true")
            //{
            //    connectionString = DEncrypt.DESEncrypt.Decrypt(connectionString);
            //}
            return connectionString;
        }

    }
    /// <summary>
    /// SQL参数对象
    /// </summary>
    public class SQLObject
    {
        public SQLObject()
        {

        }

        public SQLObject(string sql, SqlParameter[] _parms)
        {
            this.Parms = _parms;
            this.TSQL = sql;
        }

        private string _TSQL = string.Empty;
        private SqlParameter[] parms = null;

        /// <summary>
        /// 执行的SQL语句或者存储过程名
        /// </summary>
        public string TSQL
        {
            get { return _TSQL; }
            set { _TSQL = value; }
        }

        /// <summary>
        /// 参数
        /// </summary>
        public SqlParameter[] Parms
        {
            get { return parms; }
            set { parms = value; }
        }

    }
}
